<!DOCTYPE html>
<html>

	<head>
		<meta name="viewport" content="width=device-width, initial-scale=1, user-scalable=no, minimal-ui" />
		<meta name="apple-mobile-web-app-capable" content="yes" />
		<meta name="apple-mobile-web-app-status-bar-style" content="black" />
		<meta name="format-detection" content="telephone=no, email=no" />
		<meta charset="utf-8">
		<title> <!-- 将百度地图API引入，设置好自己的key --></title>
		<script type="text/javascript" src="http://api.map.baidu.com/api?v=2.0&ak=c0RcpyytG9qNmxZR7AhRIm6hvNG2EZBG"></script>
		<link rel="stylesheet" type="text/css" href="/lahuo/css/H5phone/daodianquhuan_files/common@ee713f7a54.css">
		<link rel="stylesheet" type="text/css" href="/lahuo/css/H5phone/daodianquhuan_files/zcbase@b22e88b759.css">
		<link rel="stylesheet" type="text/css" href="/lahuo/css/H5phone/daodianquhuan_files/zcorder@ccf5099280.css">
		<link rel="stylesheet" type="text/css" href="/lahuo/js/H5phone/js/styles.css" media="all">
		<script type="text/javascript" src="/lahuo/js/H5phone/js/jquery.js"></script>
		<script type="text/javascript" src="/lahuo/js/H5phone/js/moment.js"></script>
		<script type="text/javascript" src="/lahuo/js/H5phone/js/bootstrap-datetimepicker.js"></script>
		<link rel="stylesheet" href="/lahuo/static/css/bootstrap.css">
		<style>
			.btn-ordernow {
				width: 100%;
				display: inline-block;
				height: 45px;
				position: absolute;
				top: 596px;
				line-height: 45px;
				color: #fff;
				background-color: #fabe00;
				text-align: center;
				font-size: 17px;
			}
			
			body {
				margin: 0;
			}
			
			h1 {
				margin: 0px;
			}
			
			a {
				text-decoration: none;
			}
			
			.scbutton {
				font-size: 16px;
				padding: 5px;
				min-width: inherit;
			}
			
			.orangebut {
				min-width: 100px;
				background: #fdb813;
				text-align: center;
				-moz-border-radius: 20px;
				-webkit-border-radius: 20px;
				border-radius: 20px;
				border: 0;
				color: #000;
				font: normal 14px/1.5 "微软雅黑", Verdana, "Microsoft Yahei", STXihei;
				padding: 5px 18px;
				cursor: pointer;
			}
			
			.txt_City {
				width: 67%;
				border: 1px solid #ccc;
				padding: 7px 0px;
				border-radius: 3px;
				padding-left: 5px;
				-webkit-box-shadow: inset 0 1px 1px rgba(0, 0, 0, .075);
				box-shadow: inset 0 1px 1px rgba(0, 0, 0, .075);
				-webkit-transition: border-color ease-in-out .15s, -webkit-box-shadow ease-in-out .15s;
				-o-transition: border-color ease-in-out .15s, box-shadow ease-in-out .15s;
				transition: border-color ease-in-out .15s, box-shadow ease-in-out .15s
			}
			
			.txt_City:focus {
				border-color: #66afe9;
				outline: 0;
				-webkit-box-shadow: inset 0 1px 1px rgba(0, 0, 0, .075), 0 0 8px rgba(102, 175, 233, .6);
				box-shadow: inset 0 1px 1px rgba(0, 0, 0, .075), 0 0 8px rgba(102, 175, 233, .6)
			}
			
			header.zc_header_bd {
				width: 100%;
				background: #1b2939;
				height: 50px;
				position: fixed;
				top: 0;
				z-index: 99;
			}
		</style>
		
	</head>

	<body>
		<header class="zc_header_bd">
			<div class="getback" style="white-space: normal" data-url="">
				<span class="getbackimg">&nbsp;</span>
			</div>

			<h1 class="header_title" style="margin: 0px;" id="page_title">到店取还</h1>
			<div class="homeback">
				<span class="homebackimg">&nbsp;</span>
			</div>
		</header>
		<div style="position: absolute; top: 50px;">
			<input id="cityName" style="width:67%; margin-right:10px;" value="洛阳" name="" type="text" class="" placeholder="请输入${fashou}" required="required">
			<button type="button" id="searchBtn" onclick="theLocation()" class="orangebut ">查找</button>

			<input type="text" readonly class="address">
		</div>
		<!--<label >纬度：</label>-->
		<input type="text" id="lat" value="" readonly style="display: none;">

		<!--<label>经度：</label>  -->
		<input type="text" id="lng" value="" readonly style="display: none;">

		<!-- <label>地址 ：</label>-->

		<div id='allmap' style='width: 100%; height: 529px; position: absolute; top: 115px;'></div>
		<div id="selectCar" style="position: absolute;width: 100%;">
			<a href="javascript:void(0);" class="btn-ordernow">确认地址</a>
		</div>

	</body>
	<script type="text/javascript" src="/lahuo/js/H5phone/js/jquery-3.2.1.js"></script>
	<script type="text/javascript">
	
	
	
	
		function zi(id){
			
			alert(id);
		}

		$(".btn-ordernow").click(function(){
			var lnt=$("#lng").val();
			var lat=$("#lat").val();
			var address=$(".address").val();
			window.location.href="/lahuo/tolahuoinfo?lnt="+lnt+"&lat="+lat+"&address="+address;
			
		});
		
		
		function theLocation() {
			var city = document.getElementById("cityName").value;
			if(city != "") {
				map.centerAndZoom(city, 17);
				var local = new BMap.LocalSearch(map, {
					renderOptions: {
						map: map
					} // 用城市名设置地图中心点
				});
				local.search(obj.value);
			}
		}

	/* 	$(".btn-ordernow").click(function() {
			var pointA = new BMap.Point(112.409451, 34.662518);
			var pointB = new BMap.Point(113.661999, 34.752655);

			var mile = GetDistance(pointA.lat, pointA.lng, pointB.lat, pointB.lng);
			alert(mile);

		}) */

		function Rad(d) {
			return d * Math.PI / 180.0; //经纬度转换成三角函数中度分表形式。
		}

		function GetDistance(lat1, lng1, lat2, lng2) {
			var radLat1 = Rad(lat1);
			var radLat2 = Rad(lat2);
			var a = radLat1 - radLat2;
			var b = Rad(lng1) - Rad(lng2);
			var s = 2 * Math.asin(Math.sqrt(Math.pow(Math.sin(a / 2), 2) + Math.cos(radLat1) * Math.cos(radLat2) * Math.pow(Math.sin(b / 2), 2)));
			s = s * 6378.137; // 地球半径，千米;
			s = Math.round(s * 10000) / 10000; //输出为公里
			/* s = Math.round(s * 1000) / 1; //单位修改为米,取整*/
			//s=s.toFixed(4);
			return s;
		}

		loadMapAutocomplete("cityName");

		function loadMapAutocomplete(mySuggestId) {
			Ac = new BMap.Autocomplete( //建立一个自动完成的对象
				{
					"input": cityName,
				});

		}

		function MapD() {
			var obj = document.getElementById("suggestId");
			var local = new BMap.LocalSearch(map, {
				renderOptions: {
					map: map
				}
			});
			local.search(obj.value);

		}

		var map = new BMap.Map("allmap");
		var geoc = new BMap.Geocoder(); //地址解析对象  
		var markersArray = [];
		var geolocation = new BMap.Geolocation();

		var point = new BMap.Point(116.404412, 39.914714);
		map.centerAndZoom(point, 12); // 中心点  
		geolocation.getCurrentPosition(function(r) {
			if(this.getStatus() == BMAP_STATUS_SUCCESS) {
				var mk = new BMap.Marker(r.point);
				map.addOverlay(mk);
				map.panTo(r.point);
				map.enableScrollWheelZoom(true);
			} else {
				alert('failed' + this.getStatus());
			}
		}, {
			enableHighAccuracy: true
		})
		map.addEventListener("click", showInfo);

		//清除标识  
		function clearOverlays() {
			if(markersArray) {
				for(i in markersArray) {
					map.removeOverlay(markersArray[i])
				}
			}
		}
		//地图上标注  
		function addMarker(point) {
			var marker = new BMap.Marker(point);
			markersArray.push(marker);
			clearOverlays();
			map.addOverlay(marker);
		}
		//点击地图时间处理  
		function showInfo(e) {

			geoc.getLocation(e.point, function(rs) {
				var addComp = rs.addressComponents;
				var address = addComp.province + addComp.city + addComp.district + addComp.street + addComp.streetNumber;
				/*if(confirm("确定要地址是" + address + "?")) {*/
				document.getElementById('lng').value = e.point.lng;
				document.getElementById('lat').value = e.point.lat;
				$(".cityName").val(" ");
				$(".address").val(address);
			});
			addMarker(e.point);
		}
		var hidenav = 0,
			hidetab = 0,
			hideinfo = 0;
		if(hideinfo) {
			$('header').hide();
			$('footer').hide();
			$('.ecjia-menu').hide();
		} else {
			hidenav && $('header').hide();
			hidetab && $('footer').hide();
		}
	</script>
	<script type="text/javascript">
		$(document).ready(function() {
			// date time picker
			if($(".dztime.brbotda").length > 0) {

				$("#rentDate-time").datetimepicker({

					locale: "zh-cn",
					format: "YYYY-MM-DD a hh:mm",
					dayViewHeaderFormat: "YYYY年 MMMM"
				});
				$("#returnDate-time").datetimepicker({

					locale: "zh-cn",
					format: "YYYY-MM-DD a hh:mm",
					dayViewHeaderFormat: "YYYY年 MMMM"
				});
				var color = $("#rentDate-time").css("color");
				$("#rentDate-time").val("请选择取车时间");
				$("#returnDate-time").val("请选择取车时间");

			}
		})
		//短信公众号过来不要返回
		//console.log(ssgivalue);
		$(".circtip").click(function() {
			window.location.href = "/html5/newversion/info/packagehelp.html";
		});
		window.addEventListener('DOMContentLoaded', function() {
			if($('.yearrent').hasClass('current')) {
				$('.nav-box .tab-nav').scrollLeft(360);
			}
		});

		$("#fsnbox").click(
			function() {
				var city = $(this).parents(".mainbox").find("#fcnbox")
					.text().trim();
				var local = $("#tsnbox").attr("data-url") + "?place=" +
					city;
				var type = $(".dztext.dzcheng.defsmsc").data("type");
				window.location.href = local + "&zctype=1" + "&smtype=" + type;
			})
		$("#tsnbox").click(
			function() {
				var city = $(this).parents(".mainbox").find("#tcnbox")
					.text().trim();
				var local = $("#tsnbox").attr("data-url") + "?place=" +
					city;
				var type = $(".dztext.dzcheng.defsmqc").data("type");
				window.location.href = local + "&zctype=2" + "&smtype=" + type;
			})
		$("#fcnbox").click(function() {
			var city = $(this).text().trim();
			var local = $("#fcnbox").attr("data-url");
			var type = $(".dztext.dzcheng.defsmsc").data("type");
			window.location.href = local + "?city=" + city + "&zctype=" + "1" + "&smtype=" + type;
		})
		$("#tcnbox").click(function() {
			var city = $(this).text().trim();
			var local = $("#tcnbox").attr("data-url");
			var type = $(".dztext.dzcheng.defsmqc").data("type");
			window.location.href = local + "?city=" + city + "&zctype=" + "2" + "&smtype=" + type;
		})
	/* 	$("#selectCar")
			.click(
				function() {
					if($("#fsnbox").text() == null ||
						$("#fsnbox").text() == "") {
						window.alert("请选择取车门店");
					} else if($("#tsnbox").text() == null ||
						$("#tsnbox").text() == "") {
						window.alert("请选择还车门店");
					} else {
						var qctime = $("#rentDate-time").val();
						var q = new Date(qctime.substr(0, qctime
							.indexOf(' ')));
						var qcdate = q.getFullYear() + "-" +
							q.getMonth() + "-" + q.getDay();
						q = qctime.substr(qctime.indexOf(' '), 4)
							.trim();
						var hh = "";

						if(q == "下午") {
							q = qctime
								.substring(qctime.indexOf(' ') + 4);
							hh = new Date(qcdate + " " + q);
							hh.setHours(hh.getHours() + 12);
							qctime = hh.getFullYear() + "-" +
								hh.getMonth() + "-" + hh.getDay() +
								" " + hh.getHours() + ":" +
								hh.getMinutes() + ":" +
								hh.getSeconds();
						} else {
							q = qctime
								.substring(qctime.indexOf(' ') + 4);
							hh = new Date(qcdate + " " + q);
							qctime = hh.getFullYear() + "-" +
								hh.getMonth() + "-" + hh.getDay() +
								" " + hh.getHours() + ":" +
								hh.getMinutes() + ":" +
								hh.getSeconds();
						}

						/* 分割綫 */
						var hctime = $("#returnDate-time").val();
						var h = new Date(hctime.substr(0, hctime
							.indexOf(' ')));
						var hcdate = h.getFullYear() + "-" +
							h.getMonth() + "-" + h.getDay();
						h = hctime.substr(hctime.indexOf(' '), 4)
							.trim();
						var hh = "";

						if(h == "下午") {
							h = qctime
								.substring(hctime.indexOf(' ') + 4);
							hh = new Date(hcdate + " " + q);
							hh.setHours(hh.getHours() + 12);
							hctime = hh.getFullYear() + "-" +
								hh.getMonth() + "-" + hh.getDay() +
								" " + hh.getHours() + ":" +
								hh.getMinutes() + ":" +
								hh.getSeconds();
						} else {
							h = hctime
								.substring(hctime.indexOf(' ') + 4);
							hh = new Date(hcdate + " " + q);
							hctime = hh.getFullYear() + "-" +
								hh.getMonth() + "-" + hh.getDay() +
								" " + hh.getHours() + ":" +
								hh.getMinutes() + ":" +
								hh.getSeconds();
						}
						console.log(qctime + " " + hctime);
						window.location.href = "/jump/carType?qcTime=" +
							qctime + "&hcTime=" + hctime +
							"&val=" + 0;
					}

				}) */
		$(".getback").click(function() {
			window.location.href = "/jump/toPhoneHomePage";
		});
		var num = 1;
		$('.sccur').click(function(e) {
			if(num++ % 2 == 0) {
				var color = $(this).parent().css("background-color");
				if(color == "rgb(255, 194, 0)") {
					$(this).removeClass("move");
					$(this).parent().css("background-color", "white");
					$(".dztext.dzcheng.defsmsc").text("取车门店");
					var type = $(".dztext.dzcheng.defsmsc").data("type");
					if(type == "1") {
						$(".dztext.dzcheng.defsmsc").data("type", "2");
						console.log($(".dztext.dzcheng.defsmsc").data("type"));
					} else {
						$(".dztext.dzcheng.defsmsc").data("type", "1");
						console.log($(".dztext.dzcheng.defsmsc").data("type"));
					}
				} else {
					$(this).addClass("move");
					$(this).parent().css("background-color", "#FFC200");
					$(".dztext.dzcheng.defsmsc").text("取车地址");
					var type = $(".dztext.dzcheng.defsmsc").eq(0).data("type");
					if(type == "1") {
						$(".dztext.dzcheng.defsmsc").eq(0).data("type", "2");
						console.log($(".dztext.dzcheng.defsmsc").data("type"));
					} else {
						$(".dztext.dzcheng.defsmsc").eq(0).data("type", "1");
						console.log($(".dztext.dzcheng.defsmsc").data("type"));
					}
				}
				//doSomething 
			} else {
				$(this).removeClass("move");
				$(this).parent().css("background-color", "white");
				$(".dztext.dzcheng.defsmsc").text("取车门店");
				var type = $(".dztext.dzcheng.defsmsc").eq(0).data("type");
				if(type == "1") {
					$(".dztext.dzcheng.defsmsc").eq(0).data("type", "2");
					console.log($(".dztext.dzcheng.defsmsc").data("type"));
				} else {
					$(".dztext.dzcheng.defsmsc").eq(0).data("type", "1");
				}
				//doOtherSomething 
			}
			e.preventDefault(); //阻止元素的默认动作（如果存在） 
		});
		var i = 1;
		$('.scur').click(function(e) {
			if(i++ % 2 == 0) {
				var color = $(this).parent().css("background-color");
				if(color == "rgb(255, 194, 0)") {
					$(this).removeClass("move");
					$(this).parent().css("background-color", "white");
					$(".dztext.dzcheng.defsmqc").text("取车门店");
					var type = $(".dztext.dzcheng.defsmqc").data("type");
					if(type == "1") {
						$(".dztext.dzcheng.defsmqc").data("type", "2");
						console.log($(".dztext.dzcheng.defsmqc").data("type"));
					} else {
						$(".dztext.dzcheng.defsmqc").data("type", "1");
						console.log($(".dztext.dzcheng.defsmqc").data("type"));
					}
				} else {
					$(this).addClass("move");
					$(this).parent().css("background-color", "#FFC200");
					$(".dztext.dzcheng.defsmqc").text("取车地址");
					var type = $(".dztext.dzcheng.defsmqc").eq(0).data("type");
					if(type == "1") {
						$(".dztext.dzcheng.defsmqc").eq(0).data("type", "2");
						console.log($(".dztext.dzcheng.defsmqc").data("type"));
					} else {
						$(".dztext.dzcheng.defsmqc").eq(0).data("type", "1");
						console.log($(".dztext.dzcheng.defsmqc").data("type"));
					}
				}
				//doSomething 
			} else {
				$(this).removeClass("move");
				$(this).parent().css("background-color", "white");
				$(".dztext.dzcheng.defsmqc").text("取车门店");
				var type = $(".dztext.dzcheng.defsmqc").eq(0).data("type");
				if(type == "1") {
					$(".dztext.dzcheng.defsmqc").eq(0).data("type", "2");
					console.log($(".dztext.dzcheng.defsmqc").data("type"));
				} else {
					$(".dztext.dzcheng.defsmqc").eq(0).data("type", "1");
					console.log($(".dztext.dzcheng.defsmqc").data("type"));
				}
				//doOtherSomething 
			}
			e.preventDefault(); //阻止元素的默认动作（如果存在） 
		});
	</script>

</html>